import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
public class GameFrame extends JFrame {
    JPanel cards = new JPanel(new CardLayout());
    GamePanel panel = new GamePanel();
    public GameFrame() {
        Container contentPane = getContentPane();
        contentPane.setLayout(new BorderLayout());
        contentPane.add(cards, BorderLayout.CENTER);
        PlantPanel plantPanel = new PlantPanel();
        cards.add("scene1", panel);
        cards.add("scene2", plantPanel);
        CardLayout cl = (CardLayout) cards.getLayout();
        cl.show(cards, "scene2");
        JButton button = new JButton();
        panel.add(button);
        button.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                panel.requestFocus();
                CardLayout cl = (CardLayout) cards.getLayout();
                cl.show(cards, "scene2");
            }
        });
        panel.setLayout(null);
        button.setBounds(380, 370, 100, 20);
    }
}


